package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.dao.impl.InfoDao;
import org.entity.WuLiuMessage;
import org.service.impl.Infoservice;

public class InfoServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html; charset=UTF-8");
		
		PrintWriter out = response.getWriter();
		
		int orderid = Integer.parseInt(request.getParameter("orderid"));
		Infoservice inf=new Infoservice();
		List<String> queryAllWuLiuMessage = inf.queryAllWuLiuMessage(orderid);
		HttpSession session=request.getSession();
		WuLiuMessage wuLiuMessage=new WuLiuMessage();
		wuLiuMessage.setMessages(queryAllWuLiuMessage);
		wuLiuMessage.setOrderid(orderid);
		
		session.setAttribute("wuLiuMessage", wuLiuMessage);
		
		response.sendRedirect("follow2.jsp");
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
